<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创业平台后台系统</title>
    <link rel="stylesheet"href="__STATIC__/layui1/css/layui.css">
    <link rel="stylesheet" href="__STATIC__/css/page.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    {include file="public/head"}
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 30px;">

            <button onclick="location.href='add'" type="button" class="layui-btn" style="margin-top:-20px">
                <i class="layui-icon">&#xe608;</i> 添加用户
            </button>

            <table class="layui-table"lay-filter="demo" style="width: 800px;height: 480px">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>头像</th>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>分类</th>
                    <th>生日</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <?php
                foreach ($list as $item) {
                    echo "
                    <tr style=\"height: 100px\">
                    <td>$item[id]</td>
                    <td><img src=\"__UPLOADS__/$item[icon]\"></td>
                    <td>$item[name]</td>
                    <td>$item[age]</td>
                    <td>$item[type_text]</td>
                    <td>$item[birthday]</td>
                    <td>
                        <a  href=\"" . url('user/edit', ['id' => $item['id']]) . "\"
                        class=\"layui-btn layui-btn-md\" lay-event=\"edit\">编辑</a>                       
                        <button onclick=\"showDel('$item[name]',$item[id])\"
                                class=\"layui-btn layui-btn-danger layui-btn-md\">删除
                        </button>
                    </td>
                </tr>                  
                    ";
                }
                ?>
                </tbody>
            </table>
           {$list|raw}
        </div>
    </div>
    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script src="__STATIC__/layui1/layui.js"></script>
<script>
    layui.use(['element','layer'], function(){
        var element = layui.element;
        var layer = layui.layer;
    });

    function showDel(name,id){
        layer.confirm('确认删除？'+name+'?', {
            btn: ['确认', '取消'] //可以无限个按钮
        }, function(index, layero){
            //按钮【按钮一】的回调
            // alert(id);
            //页面跳转的方式：访问接口
            location.href="{:url('user/del')}"+"?id="+id;
        }, function(index){
            //按钮【按钮二】的回调
        });
    }
</script>
</body>
</html>